import request from "@/utils/request";
import log from "@/views/monitor/job/log";
//分散式房源

//添加分散式房源
export function saveTbHouseInfo(query){
   return request({
      url:'/housing/tb-house-info',
      method:'post',
      data:query,
   })
}
//查询sys_user 用于管家下拉框
export function sysUserList(){
  return request({
     url:'/housing/sys-user/list',
     method:'get',
  })
}
//查询独立配置
export function tbPrivateFacilityList(){
   return request({
      url:'/housing/tb-private-facility/list',
      method:'get',
   })
}
//查询公共配置
export function tbPublicFacilityList(){
   return request({
      url:'/housing/tb-public-facility/list',
      method:'get',
   })
}
//查询楼盘名称
export function TbPremisesInfoList(name){
  console.log("方法中")
   console.log(name)
   return request({
     url:'/housing/tb-premises-info/list',
     method:'post', //post怎么能传一个字段呢 你去查查post和get请求 写个笔记
     data: {name:name},
   })
}
//图片上传
export function uploadfile(file,fileObj){
  return request({
    url: '/housing/tb-house-info/uploadfile',
    method: 'post',
    data: file,
    headers: { 'Content-Type': 'multipart/form-data' },
    onUploadProgress: progressEvent => {
      const complete = (progressEvent.loaded / progressEvent.total * 100 | 0)
      fileObj.onProgress({ percent: complete })     //调用upload组件的 onProgress
    }
  })
}
//根据houseId获取分散式房源数据
export function getDistributedHouseIfOne(id,premisesName){
  return request({
    url:'/housing/tb-house-info/getDistributedHouseIfOne',
    method:'post',
    data:{id:id,premisesName:premisesName},
  })
}
